package com.bluedot.www.framework.ibatis.utils;


import com.bluedot.www.framework.ibatis.mybaits.confiuration.Configuration;

import java.sql.Connection;
import java.sql.DriverManager;

/**
 * 连接工具
 *
 * @author GUOZHIPENG
 * @version 1.0
 * @date 2021/8/8 7:34
 */
public class ConnectionUtil {


    public static Connection getConnection(Configuration configuration) {
        try {
            Class.forName(configuration.getDriver());
            return DriverManager.getConnection(configuration.getUrl(), configuration.getUsername(), configuration.getPassword());
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
